import { createBrowserRouter } from 'react-router-dom'
import Layout from '../page/Layout'
import Login from '../page/login'
import About from '../page/About'
import Board from '../page/Board'
import Article from '../page/Article'
import NotFound from '../page/NotFound '

const router = createBrowserRouter([
  {
    path: '/',
    element: <Layout />,
    children: [
      {
        // path: 'board',
        index: true, // 设置为二级路由的默认路由
        element: <Board />
      },
      {
        path: 'article/:user',
        element: <Article />
      }
    ]
  },
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/about',
    element: <About />
  },
  {
    path: '*',
    element: <NotFound />,
  }
])

export default router
